<template>
<div class="tags-cp">
    <span 
        v-for="(item,index) in tags" 
        :key="index" 
        @click="goPath(item.name)">
        {{item.name}}
    </span>
</div>
</template>

<script>
//标签列表展示组件
export default {
    props:{
        tags:{ //标签数据
            type:Array,
            default:()=>{
                return [];
            },
        },
        type:{  //需要搜索的数据类型
            type:Number,
            default:1,
        },
    },
    methods:{
        goPath(name){
            this.$router.push({
                path: '/search',
                query: {
                    keyWord: name,
                    type:this.type,
                }
            }).catch(()=>{return;});
        },
    },
}
</script>
<style lang="scss" scoped>
.tags-cp{
    width:fit-content;
    span{
        font-size: 1.1rem;
        color: #899bb4;
        margin-right: 15px;
        cursor: pointer;
        transition: all 0.2s;
        &:hover{
            color: #535f6e;
        }
    }
}
</style>

